﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using KPIS.GERP.Models.Class;
using KPIS.GERP.Models.BGM;

namespace KPIS.GERP.Models.ICM
{
    [DataContract, Table("IcmOfficeSuppliesLot")]
    public class OfficeSuppliesLot
    {

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "OfficeSuppliesLotId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int OfficeSuppliesLotId { get; set; }

        [ForeignKey("MasResourceItem")]
        [DataMember, Display(Name = "ResItemId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? ResItemId { get; set; }

        [CustomRequired]
        [StringLength(50)]
        [DataMember, Display(Name = "LotNo", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public string LotNo { get; set; }

        [CustomRequired]
        [DataMember, Display(Name = "Description", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public string Description { get; set; }

        [CustomRequired]
        [DataMember, Display(Name = "Quantity", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int Quantity { get; set; }

        [DisplayFormat(DataFormatString = "{0:N4}")]
        [CustomRequired]
        [DataMember, Display(Name = "Price", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public decimal Price { get; set; }

        [ForeignKey("Warehouse")]
        [DataMember, Display(Name = "WhId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? WhId { get; set; }

        [ForeignKey("MasBudgetSource")]
        [DataMember]
        public Nullable<int> BgSourceId { get; set; }

        [ForeignKey("ProjectExpense")]
        [DataMember, Display(Name = "ProjectId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? ProjExpId { get; set; }

        [ForeignKey("ReceiveDtl")]
        [DataMember, Display(Name = "ReceiveDtlId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? ReceiveDtlId { get; set; }

        [ForeignKey("MasUnit")]
        [DataMember, Display(Name = "UnitId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? UnitId { get; set; }

        [DataMember, Display(Name = "ExpireDate", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public DateTime? ExpireDate { get; set; }

        [DataMember, Display(Name = "PicturePath", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public string PicturePath { get; set; }

        [DataMember, Display(Name = "Remark", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public string Remark { get; set; }

        [StringLength(2)]
        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public System.DateTime? CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public Nullable<int> UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public Nullable<System.DateTime> UpdatedWhen { get; set; }

        [ForeignKey("OfficeSupplyLotStatus")]
        [DataMember, Display(Name = "OfficeSupplyLotStatusId", ResourceType = typeof(Resources.OfficeSuppliesLotResource))]
        public int? OfficeSupplyLotStatusId { get; set; }

        [DataMember]
        public virtual ReceiveDtl ReceiveDtl { get; set; }

        [DataMember]
        public virtual Warehouse Warehouse { get; set; }

        [DataMember]
        public virtual MasUnit MasUnit { get; set; }
        
        [DataMember]
        public virtual BGM.ProjectExpense ProjectExpense { get; set; }

        [DataMember]
        public virtual MasResourceItem MasResourceItem { get; set; }

        [DataMember]
        public virtual IcmMasLookUp OfficeSupplyLotStatus { get; set; }

        [DataMember]
        public virtual MasBudgetSource MasBudgetSource { get; set; }
    }
}
